#include		"RotatingBuffer.h"

RotatingBuffer::RotatingBuffer() : _buffer(4096)
{

}

RotatingBuffer::~RotatingBuffer()
{

}

void			RotatingBuffer::init()
{
	_buffer.clear();
}

byte			RotatingBuffer::read()
{
	byte		data = 0;

	if (!empty())
	{
		data = *_buffer.begin();
		_buffer.pop_front();
	}
	return data;
}

void			RotatingBuffer::write(byte data)
{
	_buffer.push_back(data);
}

bool			RotatingBuffer::empty()
{
	return _buffer.empty();
}

int				RotatingBuffer::size()
{
	return _buffer.size();
}

int				RotatingBuffer::capacity()
{
	return _buffer.capacity();
}

byte			RotatingBuffer::operator[](size_t value)
{
	return _buffer[value];
}